Integrand size = 13, antiderivative size = 87 \[ \int \frac {\sin ^2(x)}{(a+b \sin (x))^2} \, dx=\frac {x}{b^2}-\frac {2 a \left (a^2-2 b^2\right ) \arctan \left (\frac {b+a \tan \left (\frac {x}{2}\right )}{\sqrt {a^2-b^2}}\right )}{b^2 \left (a^2-b^2\right )^{3/2}}+\frac {a^2 \cos (x)}{b \left (a^2-b^2\right ) (a+b \sin (x))} \]
x/b^2-2*a*(a^2-2*b^2)*arctan((b+a*tan(1/2*x))/(a^2-b^2)^(1/2))/b^2/(a^2-b^ 2)^(3/2)+a^2*cos(x)/b/(a^2-b^2)/(a+b*sin(x))
Time = 0.20 (sec) , antiderivative size = 83, normalized size of antiderivative = 0.95 \[ \int \frac {\sin ^2(x)}{(a+b \sin (x))^2} \, dx=\frac {x-\frac {2 a \left (a^2-2 b^2\right ) \arctan \left (\frac {b+a \tan \left (\frac {x}{2}\right )}{\sqrt {a^2-b^2}}\right )}{\left (a^2-b^2\right )^{3/2}}+\frac {a^2 b \cos (x)}{(a-b) (a+b) (a+b \sin (x))}}{b^2} \]
(x - (2*a*(a^2 - 2*b^2)*ArcTan[(b + a*Tan[x/2])/Sqrt[a^2 - b^2]])/(a^2 - b ^2)^(3/2) + (a^2*b*Cos[x])/((a - b)*(a + b)*(a + b*Sin[x])))/b^2
Time = 0.46 (sec) , antiderivative size = 118, normalized size of antiderivative = 1.36, number of steps used = 9, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.615, Rules used = {3042, 3269, 3042, 3214, 3042, 3139, 1083, 217}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \frac {\sin ^2(x)}{(a+b \sin (x))^2} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {\sin (x)^2}{(a+b \sin (x))^2}dx\) |
\(\Big \downarrow \) 3269 |
\(\displaystyle \frac {\int \frac {a b+\left (a^2-b^2\right ) \sin (x)}{a+b \sin (x)}dx}{b \left (a^2-b^2\right )}+\frac {a^2 \cos (x)}{b \left (a^2-b^2\right ) (a+b \sin (x))}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {\int \frac {a b+\left (a^2-b^2\right ) \sin (x)}{a+b \sin (x)}dx}{b \left (a^2-b^2\right )}+\frac {a^2 \cos (x)}{b \left (a^2-b^2\right ) (a+b \sin (x))}\) |
\(\Big \downarrow \) 3214 |
\(\displaystyle \frac {\frac {x \left (a^2-b^2\right )}{b}-\frac {a \left (a^2-2 b^2\right ) \int \frac {1}{a+b \sin (x)}dx}{b}}{b \left (a^2-b^2\right )}+\frac {a^2 \cos (x)}{b \left (a^2-b^2\right ) (a+b \sin (x))}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {\frac {x \left (a^2-b^2\right )}{b}-\frac {a \left (a^2-2 b^2\right ) \int \frac {1}{a+b \sin (x)}dx}{b}}{b \left (a^2-b^2\right )}+\frac {a^2 \cos (x)}{b \left (a^2-b^2\right ) (a+b \sin (x))}\) |
\(\Big \downarrow \) 3139 |
\(\displaystyle \frac {\frac {x \left (a^2-b^2\right )}{b}-\frac {2 a \left (a^2-2 b^2\right ) \int \frac {1}{a \tan ^2\left (\frac {x}{2}\right )+2 b \tan \left (\frac {x}{2}\right )+a}d\tan \left (\frac {x}{2}\right )}{b}}{b \left (a^2-b^2\right )}+\frac {a^2 \cos (x)}{b \left (a^2-b^2\right ) (a+b \sin (x))}\) |
\(\Big \downarrow \) 1083 |
\(\displaystyle \frac {\frac {4 a \left (a^2-2 b^2\right ) \int \frac {1}{-\left (2 b+2 a \tan \left (\frac {x}{2}\right )\right )^2-4 \left (a^2-b^2\right )}d\left (2 b+2 a \tan \left (\frac {x}{2}\right )\right )}{b}+\frac {x \left (a^2-b^2\right )}{b}}{b \left (a^2-b^2\right )}+\frac {a^2 \cos (x)}{b \left (a^2-b^2\right ) (a+b \sin (x))}\) |
\(\Big \downarrow \) 217 |
\(\displaystyle \frac {\frac {x \left (a^2-b^2\right )}{b}-\frac {2 a \left (a^2-2 b^2\right ) \arctan \left (\frac {2 a \tan \left (\frac {x}{2}\right )+2 b}{2 \sqrt {a^2-b^2}}\right )}{b \sqrt {a^2-b^2}}}{b \left (a^2-b^2\right )}+\frac {a^2 \cos (x)}{b \left (a^2-b^2\right ) (a+b \sin (x))}\) |
(((a^2 - b^2)*x)/b - (2*a*(a^2 - 2*b^2)*ArcTan[(2*b + 2*a*Tan[x/2])/(2*Sqr t[a^2 - b^2])])/(b*Sqrt[a^2 - b^2]))/(b*(a^2 - b^2)) + (a^2*Cos[x])/(b*(a^ 2 - b^2)*(a + b*Sin[x]))
3.2.87.3.1 Defintions of rubi rules used
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[-b, 2])^( -1))*ArcTan[Rt[-b, 2]*(x/Rt[-a, 2])], x] /; FreeQ[{a, b}, x] && PosQ[a/b] & & (LtQ[a, 0] || LtQ[b, 0])
Int[((a_) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Simp[-2 Subst[I nt[1/Simp[b^2 - 4*a*c - x^2, x], x], x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x]
Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{e = Fre eFactors[Tan[(c + d*x)/2], x]}, Simp[2*(e/d) Subst[Int[1/(a + 2*b*e*x + a *e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}, x] && NeQ [a^2 - b^2, 0]
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_. )*(x_)]), x_Symbol] :> Simp[b*(x/d), x] - Simp[(b*c - a*d)/d Int[1/(c + d *Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]
Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)])^2, x_Symbol] :> Simp[(-(b^2*c^2 - 2*a*b*c*d + a^2*d^2))*Cos[e + f*x]*((a + b*Sin[e + f*x])^(m + 1)/(b*f*(m + 1)*(a^2 - b^2))), x] - Simp[ 1/(b*(m + 1)*(a^2 - b^2)) Int[(a + b*Sin[e + f*x])^(m + 1)*Simp[b*(m + 1) *(2*b*c*d - a*(c^2 + d^2)) + (a^2*d^2 - 2*a*b*c*d*(m + 2) + b^2*(d^2*(m + 1 ) + c^2*(m + 2)))*Sin[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 - b^2, 0] && LtQ[m, -1]
Time = 0.54 (sec) , antiderivative size = 121, normalized size of antiderivative = 1.39
method | result | size |
default | \(\frac {2 \arctan \left (\tan \left (\frac {x}{2}\right )\right )}{b^{2}}-\frac {2 a \left (\frac {-\frac {b^{2} \tan \left (\frac {x}{2}\right )}{a^{2}-b^{2}}-\frac {a b}{a^{2}-b^{2}}}{a \left (\tan ^{2}\left (\frac {x}{2}\right )\right )+2 b \tan \left (\frac {x}{2}\right )+a}+\frac {\left (a^{2}-2 b^{2}\right ) \arctan \left (\frac {2 a \tan \left (\frac {x}{2}\right )+2 b}{2 \sqrt {a^{2}-b^{2}}}\right )}{\left (a^{2}-b^{2}\right )^{\frac {3}{2}}}\right )}{b^{2}}\) | \(121\) |
risch | \(\frac {x}{b^{2}}-\frac {2 i a^{2} \left (i b +a \,{\mathrm e}^{i x}\right )}{b^{2} \left (a^{2}-b^{2}\right ) \left (-i b \,{\mathrm e}^{2 i x}+i b +2 a \,{\mathrm e}^{i x}\right )}+\frac {a^{3} \ln \left ({\mathrm e}^{i x}+\frac {i a \sqrt {-a^{2}+b^{2}}-a^{2}+b^{2}}{b \sqrt {-a^{2}+b^{2}}}\right )}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right ) \left (a -b \right ) b^{2}}-\frac {2 a \ln \left ({\mathrm e}^{i x}+\frac {i a \sqrt {-a^{2}+b^{2}}-a^{2}+b^{2}}{b \sqrt {-a^{2}+b^{2}}}\right )}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right ) \left (a -b \right )}-\frac {a^{3} \ln \left ({\mathrm e}^{i x}+\frac {i a \sqrt {-a^{2}+b^{2}}+a^{2}-b^{2}}{b \sqrt {-a^{2}+b^{2}}}\right )}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right ) \left (a -b \right ) b^{2}}+\frac {2 a \ln \left ({\mathrm e}^{i x}+\frac {i a \sqrt {-a^{2}+b^{2}}+a^{2}-b^{2}}{b \sqrt {-a^{2}+b^{2}}}\right )}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right ) \left (a -b \right )}\) | \(360\) |
2/b^2*arctan(tan(1/2*x))-2/b^2*a*((-b^2/(a^2-b^2)*tan(1/2*x)-a*b/(a^2-b^2) )/(a*tan(1/2*x)^2+2*b*tan(1/2*x)+a)+(a^2-2*b^2)/(a^2-b^2)^(3/2)*arctan(1/2 *(2*a*tan(1/2*x)+2*b)/(a^2-b^2)^(1/2)))
Leaf count of result is larger than twice the leaf count of optimal. 167 vs. \(2 (81) = 162\).
Time = 0.33 (sec) , antiderivative size = 403, normalized size of antiderivative = 4.63 \[ \int \frac {\sin ^2(x)}{(a+b \sin (x))^2} \, dx=\left [\frac {2 \, {\left (a^{4} b - 2 \, a^{2} b^{3} + b^{5}\right )} x \sin \left (x\right ) - {\left (a^{4} - 2 \, a^{2} b^{2} + {\left (a^{3} b - 2 \, a b^{3}\right )} \sin \left (x\right )\right )} \sqrt {-a^{2} + b^{2}} \log \left (-\frac {{\left (2 \, a^{2} - b^{2}\right )} \cos \left (x\right )^{2} - 2 \, a b \sin \left (x\right ) - a^{2} - b^{2} - 2 \, {\left (a \cos \left (x\right ) \sin \left (x\right ) + b \cos \left (x\right )\right )} \sqrt {-a^{2} + b^{2}}}{b^{2} \cos \left (x\right )^{2} - 2 \, a b \sin \left (x\right ) - a^{2} - b^{2}}\right ) + 2 \, {\left (a^{5} - 2 \, a^{3} b^{2} + a b^{4}\right )} x + 2 \, {\left (a^{4} b - a^{2} b^{3}\right )} \cos \left (x\right )}{2 \, {\left (a^{5} b^{2} - 2 \, a^{3} b^{4} + a b^{6} + {\left (a^{4} b^{3} - 2 \, a^{2} b^{5} + b^{7}\right )} \sin \left (x\right )\right )}}, \frac {{\left (a^{4} b - 2 \, a^{2} b^{3} + b^{5}\right )} x \sin \left (x\right ) + {\left (a^{4} - 2 \, a^{2} b^{2} + {\left (a^{3} b - 2 \, a b^{3}\right )} \sin \left (x\right )\right )} \sqrt {a^{2} - b^{2}} \arctan \left (-\frac {a \sin \left (x\right ) + b}{\sqrt {a^{2} - b^{2}} \cos \left (x\right )}\right ) + {\left (a^{5} - 2 \, a^{3} b^{2} + a b^{4}\right )} x + {\left (a^{4} b - a^{2} b^{3}\right )} \cos \left (x\right )}{a^{5} b^{2} - 2 \, a^{3} b^{4} + a b^{6} + {\left (a^{4} b^{3} - 2 \, a^{2} b^{5} + b^{7}\right )} \sin \left (x\right )}\right ] \]
[1/2*(2*(a^4*b - 2*a^2*b^3 + b^5)*x*sin(x) - (a^4 - 2*a^2*b^2 + (a^3*b - 2 *a*b^3)*sin(x))*sqrt(-a^2 + b^2)*log(-((2*a^2 - b^2)*cos(x)^2 - 2*a*b*sin( x) - a^2 - b^2 - 2*(a*cos(x)*sin(x) + b*cos(x))*sqrt(-a^2 + b^2))/(b^2*cos (x)^2 - 2*a*b*sin(x) - a^2 - b^2)) + 2*(a^5 - 2*a^3*b^2 + a*b^4)*x + 2*(a^ 4*b - a^2*b^3)*cos(x))/(a^5*b^2 - 2*a^3*b^4 + a*b^6 + (a^4*b^3 - 2*a^2*b^5 + b^7)*sin(x)), ((a^4*b - 2*a^2*b^3 + b^5)*x*sin(x) + (a^4 - 2*a^2*b^2 + (a^3*b - 2*a*b^3)*sin(x))*sqrt(a^2 - b^2)*arctan(-(a*sin(x) + b)/(sqrt(a^2 - b^2)*cos(x))) + (a^5 - 2*a^3*b^2 + a*b^4)*x + (a^4*b - a^2*b^3)*cos(x)) /(a^5*b^2 - 2*a^3*b^4 + a*b^6 + (a^4*b^3 - 2*a^2*b^5 + b^7)*sin(x))]
Timed out. \[ \int \frac {\sin ^2(x)}{(a+b \sin (x))^2} \, dx=\text {Timed out} \]
Exception generated. \[ \int \frac {\sin ^2(x)}{(a+b \sin (x))^2} \, dx=\text {Exception raised: ValueError} \]
Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'assume' command before evaluation *may* help (example of legal syntax is 'assume(4*b^2-4*a^2>0)', see `assume?` f or more de
Time = 0.31 (sec) , antiderivative size = 124, normalized size of antiderivative = 1.43 \[ \int \frac {\sin ^2(x)}{(a+b \sin (x))^2} \, dx=-\frac {2 \, {\left (a^{3} - 2 \, a b^{2}\right )} {\left (\pi \left \lfloor \frac {x}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (a\right ) + \arctan \left (\frac {a \tan \left (\frac {1}{2} \, x\right ) + b}{\sqrt {a^{2} - b^{2}}}\right )\right )}}{{\left (a^{2} b^{2} - b^{4}\right )} \sqrt {a^{2} - b^{2}}} + \frac {2 \, {\left (a b \tan \left (\frac {1}{2} \, x\right ) + a^{2}\right )}}{{\left (a^{2} b - b^{3}\right )} {\left (a \tan \left (\frac {1}{2} \, x\right )^{2} + 2 \, b \tan \left (\frac {1}{2} \, x\right ) + a\right )}} + \frac {x}{b^{2}} \]
-2*(a^3 - 2*a*b^2)*(pi*floor(1/2*x/pi + 1/2)*sgn(a) + arctan((a*tan(1/2*x) + b)/sqrt(a^2 - b^2)))/((a^2*b^2 - b^4)*sqrt(a^2 - b^2)) + 2*(a*b*tan(1/2 *x) + a^2)/((a^2*b - b^3)*(a*tan(1/2*x)^2 + 2*b*tan(1/2*x) + a)) + x/b^2
Time = 9.99 (sec) , antiderivative size = 2562, normalized size of antiderivative = 29.45 \[ \int \frac {\sin ^2(x)}{(a+b \sin (x))^2} \, dx=\text {Too large to display} \]
((2*a^2)/(b*(a^2 - b^2)) + (2*a*tan(x/2))/(a^2 - b^2))/(a + 2*b*tan(x/2) + a*tan(x/2)^2) - (2*atan((64*a^3*b^3*tan(x/2))/((64*a^3*b^9)/(b^6 - 2*a^2* b^4 + a^4*b^2) + (128*a^5*b^7)/(b^6 - 2*a^2*b^4 + a^4*b^2) - (192*a^7*b^5) /(b^6 - 2*a^2*b^4 + a^4*b^2) + (64*a^9*b^3)/(b^6 - 2*a^2*b^4 + a^4*b^2) - (64*a*b^11)/(b^6 - 2*a^2*b^4 + a^4*b^2)) + (64*a*b^5*tan(x/2))/((64*a^3*b^ 9)/(b^6 - 2*a^2*b^4 + a^4*b^2) + (128*a^5*b^7)/(b^6 - 2*a^2*b^4 + a^4*b^2) - (192*a^7*b^5)/(b^6 - 2*a^2*b^4 + a^4*b^2) + (64*a^9*b^3)/(b^6 - 2*a^2*b ^4 + a^4*b^2) - (64*a*b^11)/(b^6 - 2*a^2*b^4 + a^4*b^2)) - (64*a^5*b*tan(x /2))/((64*a^3*b^9)/(b^6 - 2*a^2*b^4 + a^4*b^2) + (128*a^5*b^7)/(b^6 - 2*a^ 2*b^4 + a^4*b^2) - (192*a^7*b^5)/(b^6 - 2*a^2*b^4 + a^4*b^2) + (64*a^9*b^3 )/(b^6 - 2*a^2*b^4 + a^4*b^2) - (64*a*b^11)/(b^6 - 2*a^2*b^4 + a^4*b^2)))) /b^2 + (a*atan(((a*(a^2 - 2*b^2)*(-(a + b)^3*(a - b)^3)^(1/2)*((32*(a^6*b + a^2*b^5 - 2*a^4*b^3))/(b^6 - 2*a^2*b^4 + a^4*b^2) + (32*tan(x/2)*(2*a*b^ 7 - 2*a^7*b - 9*a^3*b^5 + 8*a^5*b^3))/(b^7 - 2*a^2*b^5 + a^4*b^3) + (a*(a^ 2 - 2*b^2)*(-(a + b)^3*(a - b)^3)^(1/2)*((32*(a*b^8 - a^3*b^6))/(b^6 - 2*a ^2*b^4 + a^4*b^2) + (32*tan(x/2)*(4*a^2*b^8 - 6*a^4*b^6 + 2*a^6*b^4))/(b^7 - 2*a^2*b^5 + a^4*b^3) + (a*(a^2 - 2*b^2)*((32*(a^2*b^9 - 2*a^4*b^7 + a^6 *b^5))/(b^6 - 2*a^2*b^4 + a^4*b^2) + (32*tan(x/2)*(3*a*b^11 - 8*a^3*b^9 + 7*a^5*b^7 - 2*a^7*b^5))/(b^7 - 2*a^2*b^5 + a^4*b^3))*(-(a + b)^3*(a - b)^3 )^(1/2))/(b^8 - 3*a^2*b^6 + 3*a^4*b^4 - a^6*b^2)))/(b^8 - 3*a^2*b^6 + 3...